<% unless @issues_by_tracker.empty? %>

<% content_for :header_tags do %>
    <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" %>
<% end %>

<%= javascript_include_tag "highcharts-3.0.1/highcharts.js",        :plugin => 'redcharts' %>
<%= javascript_include_tag "highcharts-3.0.1/modules/exporting.js", :plugin => 'redcharts' %>

<% @issues_by_tracker.each { |tracker_id, issues| %>
    <% content_for :header_tags do %>
        <script type="text/javascript">
            $(function () {
                $('#container_<%= tracker_id.to_s.gsub(' ','_') %>').highcharts({
                    chart: {
                        zoomType: 'x',
                        spacingRight: 20
                    },
                    title: {
                        text: '<%= tracker_id.to_s %>'
                    },
                    subtitle: {
                        text: 'Click and drag in the plot area to zoom in'
                    },
                    xAxis: {
                        type: 'datetime',
                        maxZoom: 31 * 24 * 3600000, // one month
                    },
                    yAxis: [{
                        title: {
                            text: 'Number of issues'
                        }}]
                    ,
                    legend: {
                        enabled: true
                    },
                    credits: {
                        enabled: false
                    },
                    <%= render_chart_series(issues) %>
                });
            });
        </script>
    <% end %>
    <div id="container_<%= tracker_id.to_s.gsub(' ','_') %>" style="min-width: 400px; height: 500px; margin: 0 auto"></div>
<% } %>
<% end %>

<% content_for :sidebar do %>
    <%= render :partial => 'issues/sidebar' %>
<% end %>